<?php 
	$this->lang->load('userauth', $this->session->userdata('ua_language')); 
?>
	<h2><?php echo $form_title?></h2>
<?php
	if (isset($msg)) { echo "<p class=\"error\">$msg</p>"; }

	if ($mode == 'add') { 
?>
	<div id="usersholder">
		<form id="addUser" name="addUser" method="post" action="<?= site_url('admin/usergroups/addUser');?>">
		<table><tr><td>
			<label for="nomo"><?= $this->lang->line('ua_username');?></label>
		</td><td>
			<input name="nomo" type="text" id="nomo" size="30" value="<?=$this->validation->nomo;?>" /> <?=$this->validation->nomo_error; ?>
			
		</td></tr><tr><td>
			<label for="select"><?= $this->lang->line('ua_group');?></label>
		</td><td>
			<select name="grup_id" id="select">
<?php foreach ($listAllGroups->result() as $group): ?>
				<option value="<?= $group->grup_id;?>" ><?= $group->grupnomo;?></option>
<?php endforeach; ?>
			</select> <?=$this->validation->grup_id_error; ?>

		</td></tr><tr><td>
			<label for="retposxto"><?= $this->lang->line('ua_email');?></label>
		</td><td>
			<input name="retposxto" type="text" id="retposxto" size="30" value="<?=$this->validation->retposxto;?>" /> <?=$this->validation->retposxto_error; ?>
			
		</td></tr><tr><td>
			<label for="pasvorto"><?= $this->lang->line('ua_password') ;?></label>
		</td><td>
			<input name="pasvorto" type="password" id="pasvorto" size="30" value="<?=$this->validation->pasvorto;?>" /> <?=$this->validation->pasvorto_error; ?>
			
		</td></tr><tr><td>
			<label for="passconf"><?= $this->lang->line('ua_passconf');?></label>
		</td><td>
			<input name="passconf" type="password" id="passconf" size="30" value="<?=$this->validation->passconf;?>" /> <?=$this->validation->passconf_error; ?>
			
		</td></tr><tr><td>
		</td><td>
			<input type="hidden" name="cxuaktiva" value="1" id="cxuaktiva" /> <?=$this->validation->cxuaktiva_error; ?>
			
			<input type="submit" value="<?= $this->lang->line('ua_adduser');?>" />
		</td></tr></table>
		</form>
	</div>

<?php } else if ( $mode == 'edit') { ?>

	<div id="usersholder">
		<form id="editUser" name="editUser" method="post" action="<?= site_url('admin/usergroups/editUser');?>">
			<input type="hidden" name="uz_id" value="<?= $uz_id;?>" />
		<table><tr><td>
			<label for="nomo"><?= $this->lang->line('ua_username');?></label>
		</td><td>
			<input name="nomo" type="text" id="nomo" size="30" value="<?= ($this->validation->nomo_error) ? ($this->validation->nomo) : ($userinfo->nomo);?>" /> <?=$this->validation->nomo_error; ?>
			
		</td></tr><tr><td>
			<label for="select"><?= $this->lang->line('ua_group');?></label>
		</td><td>
			<select name="grup_id" id="select">
<?php foreach ($listAllGroups->result() as $group): ?>

					<option value="<?= $group->grup_id;?>" 
						<?php if ($group->grup_id == $currentgroup){echo " selected=\"selected\"";};?> >
						<?= $group->grupnomo;?>
					</option>
<?php endforeach; ?>
				
			</select> <?=$this->validation->grup_id_error; ?>
		</td></tr><tr><td>
			<label for="retposxto"><?= $this->lang->line('ua_email');?></label>
		</td><td>
			<input name="retposxto" type="text" id="retposxto" size="30" value="<?= ($this->validation->retposxto_error) ? ($this->validation->retposxto) : ($userinfo->retposxto);?>" /> <?=$this->validation->retposxto_error; ?>
			
		</td></tr><tr><td>
			<label for="pasvorto">
				<?= $this->lang->line('ua_password')?> 
				<br />( <?=$this->lang->line('ua_leave_blank')?> )
			</label>
		</td><td>
			<input name="pasvorto" type="password" id="pasvorto" size="30" value="<?= $this->validation->pasvorto;?>" /> <?=$this->validation->pasvorto_error; ?>
			
		</td></tr><tr><td>
			<label for="passconf">
				<?= $this->lang->line('ua_passconf')?>
				
				<br /> ( <?=$this->lang->line('ua_leave_blank')?> )
			</label>
		</td><td>
			<input name="passconf" type="password" id="passconf" size="30" value="" />
		</td></tr><tr><td>
		</td><td>
			<input type="hidden" name="cxuaktiva" value="1" id="cxuaktiva" /> <?=$this->validation->cxuaktiva_error; ?>
			
			<input type="submit" value="<?= $this->lang->line('ua_edituser');?>" />
		</td></tr></table>
		</form>
	</div>

<?php } else { echo $this->lang->line('ua_form_mode_error'); } ?>
